float4x4 gWVP;
float4x4 gWorld;
float3 gEyePos;


float3 gLightDir0;
float3 gLightDir1;
float3 gLightDir2;


struct VertexData
{
  float4 Pos : POSITION;
  float3 Normal : NORMAL0;
  float2 TexCoord : TEXCOORD0;
};

struct VertexOut
{
  float4 Pos : POSITION0;
  float3 NormalWorld : TEXCOORD1;
  float2 TexCoord : TEXCOORD0;
  float3 HalfLight0 : TEXCOORD2;
  float3 HalfLight1 : TEXCOORD3;
  float3 HalfLight2 : TEXCOORD4;
};




VertexOut main(VertexData i)
{
   VertexOut o;
   o.Pos = mul(i.Pos, gWVP);
   
   o.NormalWorld = mul(i.Normal, (float3x3)gWorld);
   float3 posInWorld = mul(i.Pos, gWorld).xyz;
   float3 posToEye = normalize(gEyePos - posInWorld);
   o.HalfLight0 = normalize(posToEye - gLightDir0);
   o.HalfLight1 = normalize(posToEye - gLightDir1);
   o.HalfLight2 = normalize(posToEye - gLightDir2);

   o.TexCoord = i.TexCoord;
   return o;
};